Repository navigation
test(studio): the preview regression runs green against a sealed preview - #8470
Conversation
…e to land before seeking
…server's CORS grant
… seeks have landed
jrusso1020
left a comment
There was a problem hiding this comment.
Approve.
Need ✅ · Size ✅ (+38/−3, one e2e script) · Reuse ✅ (the fake media answer copies the preview server's own CORS headers rather than restating them) · Simpler ✅ · Structure ✅
Risk: low. This is test-only code.
Checked at 38ef89c.
- The barrier is sound. Studio posts its release seek synchronously from the page during
mouseup. Messages from one window to the frame arrive in order. So once the frame receives the script's ownpreview-regression-barriermessage, posted aftermouseup, the release seek has been delivered, and the in-frameseek(7)lands last. The listener is attached before the message is posted, and it removes itself. - The CORS copy can't drift.
serverCorsForis used only when the request carries anOrigin, which only the sealed frame'scrossoriginmedia sends. It asks the server for one byte of the same URL with that origin and copies onlyaccess-control-*,varyandx-content-type-options. Unsealed requests get{}, so they are unchanged.respondPrefixis now awaited inside its own async function and therequesthandler calls it withvoid, so interception order is unchanged. - The
preview-regressionandPreview parityCI steps pass at this head. The body has thefails without the fix:line naming the script, with the two failure messages it showed on main sealed.
— Rames (hf-review)
jrusso1020
left a comment
There was a problem hiding this comment.
Approve at a6cdb13. The only change since my approval at 38ef89c is the barrier's message check. It now resolves only for a message whose origin equals the Studio page's origin, whose source is parent, and whose type is preview-regression-barrier. The script posts the barrier from the Studio page through iframe.contentWindow.postMessage, so all three hold for its own message and nothing else resolves it. The ordering argument from my first review is unchanged.
— Rames (hf-review)
What
preview-video-regression.mjsnow runs green against a sealed Studio preview (VITE_STUDIO_OPAQUE_PREVIEW_ENABLED=1) as well as an unsealed one. Two of its steps assumed a frame Studio can script. Test only; no product code changes.Why
Both steps fail the same way on
mainsealed, independent of any product change.window.__player.seek(7).mouseupreturns, so the script's seek lands second.crossorigin="anonymous", and the preview server grants it withAccess-Control-Allow-Origin: nullplus exposed headers.net::ERR_FAILED). The video errored instead of stalling, and no range request was ever held ("Native delivery was not actually held").How
mouseup, the page posts its own message to the frame and the script waits until the frame receives it, then seeks. Studio posts its release seek synchronously from the same page, messages from one window to the frame arrive in order, and the runtime applies a control seek as it arrives, so by then the release seek has landed. The same code runs in both modes; unsealed there is no posted seek and it returns at once. (A first version waited for the frame clock to show the slider's value. Under load that passed on the last drag step's value before the release's own seek arrived, so it was replaced.)OriginandSec-Fetch-Dest: video, and copies back exactly the CORS headers the server returns (access-control-*,vary,x-content-type-options). The answer can't drift from the server's own grant. An unsealed request sends noOriginand gets none, so it is unchanged.Test plan
packages/studio/tests/e2e/preview-video-regression.mjs(run against a sealed Studio).main, CI's step for this script passed 15 of 15 in the last 30 runs that reached it, so this is the loaded box, not the script.mainunsealed, not a sealed gap. It is fixed separately; this PR leaves the assertion as it is.tsc, Fallow and pre-push clean.No visible change
Only the end-to-end script changes; nothing a person sees in Studio.
Related work
Refs #8466 (sealed paused frames), Refs #7846 (the sealed-by-default preview).